//
//  MNMRequest.m
//  myNovaMobile
//
//  Created by Taylor Clifton on 2/5/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "MNMRequest.h"

@implementation MNMRequest

- (void)setURL:(NSString *)url withHTTPMethod:(NSString *)method {
	[super initWithURL:[NSURL URLWithString:url]];
	[super setHTTPMethod:method];
}

- (void)setPostParameters:(NSArray *)parameters {
	NSLog(@"Compiling Parameters");
	NSMutableString *postString = [[NSMutableString alloc] initWithString:@""];
	[postString appendString:[[parameters objectAtIndex:0] key]];
	[postString appendString:@"="];
	[postString appendString:[[parameters objectAtIndex:0] value]];
	
	for (int i = 1; i < [parameters count]; ++i) {
		[postString appendFormat:@"&%@=%@", [[parameters objectAtIndex:i] key], [[parameters objectAtIndex:i] value]];
	}
	
	NSLog(@"%@", postString);
	[super setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
}
@end
